<template>
  <div class="shopBannerWeapp" :class="'type' + config.store_info_style">
    <div
      class="shop-banner-cover"
      :style="{ backgroundImage: 'url(' + config.background_image + ')' }"
    >
      <div v-if="config.store_info_style" class="shop-banner-mask"></div>
    </div>
    <div class="shop-banner-inner">
      <div class="shop-logo">
        <img
          src="../assets/img/img_logo_w@2x.png"
          alt="店铺logo"
          draggable="false"
        />
      </div>
      <div class="shop-right-content">
        <p class="shop-right-title">水果仙仙</p>
        <p class="shop-right-info" v-if="config.store_info_style === 0">
          <span class="shop-right-tag">满减</span>
          <span class="shop-right-text">在线支付满150减30，满100减20</span>
        </p>
        <p class="shop-right-info1" v-else>
          <span>全部商品999</span>
          <span class="divid"> | </span>
          <span>上新30</span>
        </p>
      </div>
      <i v-if="config.store_info_style === 0" class="el-icon-arrow-right right-arrow"></i>
    </div>
  </div>
</template>

<script>
export default {
  props: ['value'],
  data() {
    return {
      config: this.value ? this.value : {}
    }
  },
  watch: {
    value(newVal) {
      this.config = newVal
    }
  },
  methods: {
    jump() {
      this.$router.push(this.config.link)
    }
  }
}
</script>

<style lang="less">
.shopBannerWeapp {
  .shop-banner-cover {
    position: relative;
    height: 185px;
    background-repeat: no-repeat;
    background-position: 50%;
    background-size: cover;
    .shop-banner-mask {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background-image: linear-gradient(0deg, #000, transparent);
    }
  }
  .shop-banner-inner {
    position: absolute;
    top: 110px;
    width: 100%;
    display: flex;
    justify-items: center;
    align-items: center;
    .shop-logo {
      width: 58px;
      height: 58px;
      overflow: hidden;
      vertical-align: bottom;
      margin: 0 15px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .shop-right-content {
      .shop-right-title {
        max-width: 220px;
        margin-top: 10px;
        color: #fff;
        font-weight: 700;
        font-size: 18px;
        line-height: 22px;
        text-shadow: 0 1px 15px rgba(0, 0, 0, 0.5);
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .shop-right-info {
        margin-top: 8px;
        display: flex;
        justify-items: center;
        align-items: center;
      }
      .shop-right-tag {
        display: inline-block;
        height: 14px;
        padding: 0 3px;
        font-size: 12px;
        line-height: 14px;
        background-color: #f44;
        border-radius: 1px;
        color: white;
      }
      .shop-right-text {
        margin-left: 3px;
        font-size: 12px;
        color: white;
      }
    }
    .right-arrow {
      float: right;
      color: white;
      font-size: 12px;
      position: absolute;
      right: 10px;
      bottom: 3px;
    }
  }
  &.type1 {
    height: 238px;
    .shop-banner-inner {
      top: 150px;
    }
  }
  &.type1,
  &.type3 {
    .shop-logo {
      width: 70px;
      height: 70px;
      border-radius: 50%;
      img {
        border-radius: 50%;
      }
    }
    .shop-right-content {
      .shop-right-title {
        margin-top: 0px;
        margin-bottom: 10px;
        text-shadow: none;
      }
      .shop-right-info1 {
        color: #999;
        font-size: 12px;
        .divid {
          height: 100%;
        }
      }
    }
  }
  &.type2 {
    .shop-right-title {
      margin-bottom: 10px;
    }
    .shop-right-info1 {
      color: #fff;
    }
  }
  &.type3 {
    height: 258px;
    .shop-banner-inner {
      text-align: center;
      flex-direction: column;
    }
    .shop-banner-cover {
      height: 150px;
    }
    .shop-right-content {
      .shop-right-title {
        color: black;
      }
    }
  }
  &.type4 {
    height: 250px;
    .shop-banner-inner {
      text-align: center;
      flex-direction: column;
      top: 50px;
    }
    .shop-banner-cover {
      height: 250px;
    }
    .shop-logo {
      width: 70px;
      height: 70px;
      border-radius: 50%;
      img {
        border-radius: 50%;
      }
    }
    .shop-right-title{
      margin: 15px 0;
    }
    .shop-right-info1 {
      color: #fff;
      font-size: 12px;
    }
  }
}
</style>
